window.addEventListener('load',function(){
    

// 获取元素

let ul = document.querySelector('ul')


//徽章信息
const badgeList = [
    { img: "mybadge01.jpg", text: "连续训练天数" },
    { img: "mybadge02.jpg", text: "累积训练天数" },
    { img: "mybadge03.jpg", text: "训练次数" },
    { img: "mybadge04.jpg", text: "跑步次数" },
    { img: "mybadge05.jpg", text: "骑行次数" },
    { img: "mybadge06.jpg", text: "明星圈友" },
    { img: "mybadge07.jpg", text: "评论达人" },
    { img: "mybadge08.jpg", text: "运动铁粉" },
    { img: "mybadge09.jpg", text: "" },
]

/* 
 需求：将badgeList中的数据渲染到ul中
*/
let ulHtml = ''; ////定义变量保存组装后的HTML
badgeList.forEach(function (dom, i) {
    ulHtml += `
    <li>
        <img src="../../../assets/imgs/${dom.img}" alt="">
        <p>${dom.text}</p>
    </li>
    `
})

ul.innerHTML = ulHtml //将组装后的ulHtml渲染给ul
})


